<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>首页</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->


</head>

<body class="easyui-layout">

	<%@ include file="/WEB-INF/jsp/common/header.jsp"%>
	
    <script type="text/javascript">
        $(function () {
            //绑定左侧Tree
            $('#tt').tree({
                url: 'sys/selectModuleMap?userid=',
                lines: true,
                onClick: function (node) {
                    if (node.attributes.url != '#' && node.attributes.url != '') {  // alert node text property when clicked
                        add(node.attributes.url, node.text);
                    }
                },
                onLoadSuccess: function () {
                    $('#tt').tree('collapseAll');
                    //var rows = $('#tt').tree('getChildren');
                    //alert(rows[0].ID);
                    //if (rows.length) {
                    //    $('#tt').tree('expand', rows[0].ID);
                    //}
                }
            });
            //add("/PluginSrc/StatisticalSystem/Manage/ReportStateList.aspx", "首页");
            var tabsId = 'main'; //tabs页签Id
            var tab_rightmenuId = 'tab_rightmenu'; //tabs右键菜单Id

            //绑定tabs的右键菜单
            $("#" + tabsId).tabs({
                onContextMenu: function (e, title) {//这时去掉 tabsId所在的div的这个属性：class="easyui-tabs"，否则会加载2次
                    e.preventDefault();
                    $('#' + tab_rightmenuId).menu('show', {
                        left: e.pageX,
                        top: e.pageY
                    }).data("tabTitle", title);
                }
            });

            //实例化menu的onClick事件
            $("#" + tab_rightmenuId).menu({
                onClick: function (item) {
                    CloseTab(tabsId, tab_rightmenuId, item.name);
                }
            });
        });

        var index = 0;
        function add(url, title) {
            if ($('#main').tabs('exists', title)) {
                if (confirm('已经打开了页面,是否关闭并重新加载该标签？\n警告：点击[确定]会关闭原有的标签页面并重新加载！！！如果你还没有保存过数据,请选【取消】！,')) {
                    //$('#tt').tabs('select', title);
                    $('#main').tabs('close', title);
                    $('#main').tabs('add', {
                        title: title,
                        content: "<iframe scrolling=\"auto\" frameborder=\"0\" Src=\"" + url + "\" Style=\"width:100%;height:99%;\"></iframe>",
                        iconCls: 'icon-applicationgo',
                        closable: true
                    });
                }
                else {
                    $('#main').tabs('select', title);
                }
            } else {
                $('#main').tabs('add', {
                    title: title,
                    content: "<iframe scrolling=\"auto\" frameborder=\"0\" Src=\"" + url + "\" Style=\"width:100%;height:99%;\"></iframe>",
                    iconCls: 'icon-applicationgo',
                    closable: true
                });
            }
        }

        function refresh() {
            var currTab = $('#main').tabs('getSelected'); //获得当前tab
            if (currTab) {
                var url = $(currTab.panel('options').content).attr('src');
                var title = currTab.panel('options').title;
                $('#main').tabs('close', title);
                add(url, title);
            }
        }


    </script>
	
	<div data-options="region:'north',border:false"
		style="height: 67px; padding: 0px;
        background-image: url(resourse/img/login/bg.jpg); background-repeat: repeat-x;
        overflow: hidden;">
		<div>

		</div>
		<div
			style="text-align: right; position: absolute; top: 0px; right: 10px;">
			<ul id="shortcut"> 
				<li><a href="javascript:;" title="首页"
					onclick="add('/Home/Default','首页');"> <img
						src="resourse/img/login/home.png" /> <span>首页</span>
				</a></li>
				<li><a href="javascript:;" title="修改密码"
					onclick="add('/Sys/ChangePWD','修改密码');"> <img
						src="resourse/img/login/lock.png" /><span>修改密码</span>
				</a></li> 
				<li><a href="sys/logout" title="退出系统"> <img
						src="resourse/img/login/sign-out.png" /><span>退出系统</span>
				</a></li>
			</ul>
		</div>
	</div>
	<div data-options="region:'west',split:true,title:'工具栏'"
		style="width: 300px; padding: 10px;">
            <ul id="tt"></ul>
	</div>
	<div data-options="region:'center'">
		<div id="main" class="easyui-tabs"
			style="width: 99%; height: auto; padding: 0px;"
			data-options="iconCls:'icon-save',collapsible:false,minimizable:false,maximizable:false,closable:false,tools:'#tab-tools'"
			fit="true" border="0">
			<!--工作区-->
		</div>
		<div id="tab-tools" style="border-top: none; border-right: none;">
			<a href="javascript:void(0)" class="easyui-linkbutton" plain="true"
				data-options="plain:true,iconCls:'icon-reload'" onclick="refresh()">刷新</a>
		</div>
		<div id="tab_rightmenu" class="easyui-menu"
			style="width: 150px; display: none;">
			<!-- 	<div name="tab_menu-tabclose">关闭</div> -->
			<div name="tab_menu-tabcloseall">关闭全部标签</div>
			<div name="tab_menu-tabcloseother">关闭其他标签</div>
			<div class="menu-sep"></div>
			<div name="tab_menu-tabcloseright">关闭右侧标签</div>
			<div name="tab_menu-tabcloseleft">关闭左侧标签</div>
		</div>
	</div>
	<div data-options="region:'south',border:false"
		style="height: 30px; line-height: 30px;
        padding-left: 10px; text-align:center;">
		<span> 胜利油田森诺胜利工程有限公司 </span>
	</div>
</body>
</html>
